package com.springcloud.market.pay.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
import java.util.function.Consumer;

@Service
public class OrderTimeoutHandler {
    private static final Logger logger = LoggerFactory.getLogger(OrderTimeoutHandler.class);

    @Bean
    public Consumer<String> orderCancelConsumer() {
        return orderId -> {
            logger.info("[消费者] 收到订单超时消息，订单ID: {}", orderId);
            // 这里调用订单取消逻辑，例如：
            System.out.println(orderId+"订单取消了");
            logger.warn("执行订单取消逻辑，订单ID: {}", orderId);
        };
    }
}
